<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateQuestionnairesTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('questionnaires', function (Blueprint $table) {
            $table->id()->from(config('migration.from'));

            $table->string('legal_form_type')->unsigned()->comment('Правовая форма');
            $table->foreign('legal_form_type')->references('key')->on('types')->onDelete('restrict')->onUpdate('restrict');

            $table->bigInteger('legal_form_id')->unsigned()->comment('Правовая форма');
            $table->foreign('legal_form_id')->references('id')->on('legal_form');


            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('questionnaires');
    }
}
